<?php
session_start();
error_reporting(E_ALL);
include_once 'include_classes.php';

//Connection bdd
$db=new DbConnection();
$db->OpenConnection();
//Requête d'update
$pers=$_GET['pers'];
$annee=$_GET['annee'];
$action=$_GET['action'];

if ($action==1){
    $sql="UPDATE cotisation SET validee = 1 WHERE annee=".$annee." AND personne='".$pers."';";
    $query= new DbQuery($db,$sql);
    $query->SendQuery();
    //Redirection
    echo'<script LANGUAGE="JavaScript">document.location.href="infoBde.php"</script>';


}
if ($action==0){
    $sql="DELETE FROM cotisation WHERE annee=".$annee." AND personne='".$pers."';";
    $query= new DbQuery($db,$sql);
    $query->SendQuery();

    //Redirection
    echo '<meta http-equiv="Refresh" content="0;url=infoBde.php">';

    
}

?>

